// 封装本地存储 存储数据与读取数据方法
export const SET_TOKEN = (token: string) => {
  localStorage.setItem('TOKEN', token)
}

// 本地存储获取数据
export const GET_TOKEN = () => {
  return localStorage.getItem('TOKEN')
}

// 将用户信息本地存储
export const SET_USER_INFO = (username: string, avatar: string) => {
  localStorage.setItem('username', username)
  localStorage.setItem('avatar', avatar)
}

// 获取本地存储的用户信息
export const GET_USER_INFO = () => {
  const userInfoData = {
    username: localStorage.getItem('username'),
    avatar: localStorage.getItem('avatar'),
  }
  return userInfoData
}

// 删除本地存储的数据
export const REMOVE_TOKEN_USER_INFO = () => {
  localStorage.removeItem('TOKEN')
  localStorage.removeItem('username')
  localStorage.removeItem('avatar')
}
